
import { createRouter, createWebHistory } from 'vue-router'
import PersonalCenter from '@/components/PersonalCenter.vue'
import ClubOverview from "@/components/ClubOverview.vue";
import Login from "@/components/Login.vue";
import Home from "@/components/Home.vue";
import ActivityOverview from "@/components/ActivityOverview.vue";
import CreateClub from "@/components/CreateClub.vue";

const routes = [
    {path:"/",redirect:'/login'},
    {
        path: '/login', // 通常我们会使用更具描述性的路径名
        name: 'Login',
        component: Login,
        meta: { keepAlive: false }, // 添加 meta 属性
    },
    {
        path: '/homepage',
        name: 'HomePage',
        component: Home,
        meta: { keepAlive: true }, // 添加 meta 属性
    },
    {
        path: '/personalcenter',
        name: 'PersonalCenter',
        component: PersonalCenter,
        meta: { keepAlive: true }, // 添加 meta 属性
    },
    {
        path: '/club', // 通常我们会使用更具描述性的路径名
        name: 'ClubOverview',
        component: ClubOverview,
        meta: { keepAlive: true }, // 添加 meta 属性
    },
    {
        path: '/activity',
        name: 'ActivityOverview',
        component: ActivityOverview,
        meta: { keepAlive: true }, // 添加 meta 属性
    },
    {
        path: '/createclub',
        name: 'CreateClub',
        component: CreateClub,
        meta: { keepAlive: true }, // 添加 meta 属性
    },
]

const router = createRouter({
    routes:routes,
    history: createWebHistory(process.env.BASE_URL), // 或者使用 createMemoryHistory()
})

export default router
